<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.longtop.com/intelliweb" prefix="e"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>Insert title here</title>
	</head>

	<e:View id="view">
	    <script type="text/javascript">SkinUtil.getSkin();</script>
	    <script type="text/javascript">SkinUtil.getModuleSkin();</script>
    
		<div id="Invisual Controls" style="min-height: 40px; background-color: LemonChiffon;" >
			<e:Dataset id="Dataset_UserGy" datasetDefinition="DatasetDefinition_sys.dsd" datasetRef="Dataset_UserGy" pageSize="15" loadDataCommand="Command_Load">
				<e:Field name="id" dataType="string" label="id" maxLength="32" visible="false"/>
				 <e:Field name="userId" dataType="string" label="员工号" maxLength="12" required="true"  dropDown="LookupDropDown_User"/>
				 <e:Field name="userName" dataType="string" label="员工姓名" maxLength="12" required="true"  readOnly="true"/>
				 <e:Field name="orgId" dataType="string" label="所在机构" maxLength="12" required="true"  readOnly="true" visible="false"/>
				 <e:Field name="orgName" dataType="string" label="机构名称" maxLength="12" required="true"  readOnly="true"/>
				 <e:Field name="gyId" dataType="string" label="柜员号" maxLength="12" required="true"/>
				 <e:Field name="startDate" dataType="date" label="开始日期" maxLength="10" required="true"/>
				 <e:Field name="endDate" dataType="date" label="结束日期" maxLength="10" required="true" defaultValue="2999-12-30"/>
				 <e:Field name="createUserId" dataType="string" label="创建员" readOnly="true"/>
				 <e:Field name="createTime" dataType="date" label="创建时间" readOnly="true"/>
				 <e:Field name="updateUserId" dataType="string" label="修改员" readOnly="true"/>
				 <e:Field name="updateTime" dataType="date" label="修改时间" readOnly="true"/>
			</e:Dataset>
			
			<e:Command id="Command_Save" action="com.longtop.framework.sys.user.web.UserGyListAction" method="saveUserGy" submitForm="true" validateRequired="true" onExecuteSuccess="Button_Search_onClick()">
				<e:DatasetInfo name="DatasetInfo1" dataset="Dataset_UserGy" alwayRefreshClient="false" submitType="changes"></e:DatasetInfo>
			</e:Command>
			<e:Command id="Command_Search" action="com.longtop.framework.sys.user.web.UserGyListAction" method="searchUserGy" submitForm="true" submitFormScope="all" validateRequired="true">
				<e:DatasetInfo name="DatasetInfo2" dataset="Dataset_UserGy" alwayRefreshClient="true" submitType="all"></e:DatasetInfo>
			</e:Command>
			<e:Command id="Command_Load" action="com.longtop.framework.sys.user.web.UserGyListAction" method="loadUserGy" showHintInfoOnSuccess="false">
				<e:DatasetInfo name="DatasetInfo3" dataset="Dataset_UserGy" alwayRefreshClient="true"></e:DatasetInfo>
			</e:Command>
			
			<e:LookupDropDown id="LookupDropDown_User" path="/jsp/framework/sys/user/userDropdown.jsp"	windowWidth="650" windowHeight="450" 
					autoDropDown="true" fixed="true" onSelect="LookupDropDown_User_onSelect(dropdown,iframe,text)" windowCaption="选择员工">
			</e:LookupDropDown>
			
			<e:LookupDropDown id="LookupDropDown_Org" path="/jsp/framework/sys/org/orgDropdown.jsp"	windowWidth="600" windowHeight="400" 
				autoDropDown="true" fixed="true" onSelect="LookupDropDown_Org_onSelect(dropdown,iframe,text)" windowCaption="选择机构">
			</e:LookupDropDown>
						
		</div>

		<body>
			<e:Page id="ePage" action="com.longtop.framework.sys.user.web.UserGyListAction" style="min-height: 80px; width: 100%; height: 100%;" onAfterLoadPage="ePage_onAfterLoadPage()">
				<table style="width: 100%; height: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%" align="center">
					<tr>
						<td align="left" valign="top">
							<e:Panel id="Panel_Search" style="width: 285px; height: 100%" caption="查询条件" captionIcon="/images/query_win.gif" captionStyle="color:#888888" allowFold="true" showArrowButton="false">
								<table style="text-align: left; width: 100%;" border="0" cellpadding="3" cellspacing="3" width="100%" align="center">
									<tr>
										<td width="80px" align="right">
											<e:Label id="Label_userId" caption="员工号"></e:Label>
										</td>
										<td>
											<e:Text id="Text_userId" style="width:169px;"></e:Text>
										</td>
									</tr>
									<tr>
										<td align="right">
											<e:Label id="Label_gyId" caption="柜员号"></e:Label>
										</td>
										<td>
											<e:Text id="Text_gyId" style="width:169px;"></e:Text>
										</td>
									</tr>
									<tr>
										<td width="80px" align="right">
											<e:Label id="Label_Org" caption="所属机构" />
										</td>
										<td>
											<e:Text id="Text_orgId" style="width: 169px" dropDown="LookupDropDown_Org"></e:Text>
										</td>
									</tr>									
									<tr>
										 <td></td>		
										<td>
											<e:Button id="Button_Search" style='height: 22px; width: 70px' caption="查询" command="Command_Search" icon="/images/query.gif" onClick="Button_Search_onClick()"></e:Button>&nbsp;&nbsp;
											
										</td> 
									</tr>
								</table>
							</e:Panel>
						</td>
						<td valign="top" width="100%">
							<e:Panel id="Panel_Result" style="width: 100%; height: 100%" captionStyle="color:#888888" caption="查询结果列表" captionIcon="/images/list_win.gif" showArrowButton="false">
								<table style="text-align: left; width: 100%;" border="0" cellpadding="3" cellspacing="3" >
									<tr>
										<td>
											<table style="text-align: left; width: 100%;" border="0" cellpadding="0" cellspacing="0">
												<tr>
													<td height="27px" width="1%">
														<e:RecordNavigator id="RecordNavigator_UserGy" dataset="Dataset_UserGy" showNavigatorButton="false">
															<e:RecordButton id="RecordButton_insert" label="新增" onClick="insertRecord" icon="/images/add.gif" enabled="sys_userGy:1"></e:RecordButton>
															<e:RecordButton id="RecordButton_delete" label="删除" onClick="deleteRecord" icon="/images/delete.gif" enabled="sys_userGy:2"></e:RecordButton>
															<e:RecordButton id="RecordButton_save" label="保存" icon="/images/submit.gif" onClick="RecordButton_save_onClick()" enabled="sys_userGy:3"></e:RecordButton>
														</e:RecordNavigator>
													</td>
													<td align="left" width="99%"><e:PageNavigator id="PageNavigator_UserGy" dataset="Dataset_UserGy" showRecordNum="true"></e:PageNavigator></td>
												</tr>
											</table>
										</td>
									</tr>
									<tr>
										<td>
											<e:Grid id="Grid_UserGy" style="width: 100%; height: 458px;" showIndex="true" dataset="Dataset_UserGy" onClick="Grid_UserGy_onClick()">
											</e:Grid>
										</td>
									</tr>
								</table>
							</e:Panel>
						</td>
					</tr>
			    </table>
			</e:Page>
		</body>
	</e:View>
</html>	

<script type="text/javascript">
	//init
	function ePage_onAfterLoadPage(){
	}
	
	//查询
	function Button_Search_onClick(){
	    Command_Search.execute();
	}
	
	//保存
	function RecordButton_save_onClick(){
	    Command_Save.execute();
	}
		
	//单击记录,确定主键是否可编辑
	
	function Grid_UserGy_onClick(){
		var element = event.srcElement;
		if(element.isDataCell){
			if(element.isDataCell){
		        var currentRecord = element.record;
		        if(currentRecord.state == Constant.RECORD.STATE_NEW || currentRecord.state == Constant.RECORD.STATE_INSERT) {
	          		currentRecord.dataset.getField("gyId").setReadOnly(false);
	          	} else{
			        currentRecord.dataset.getField("gyId").setReadOnly(true);
	       		}
			}
		}
	}
	
	//选择员工
	function LookupDropDown_User_onSelect(dropdown,iframe,text){
		var dataset = $J(iframe.Dataset_User);
		var record_data=$J("Dataset_UserGy").getCurrentRecord();
		if(dataset){
		    var record = dataset.getCurrentRecord();
		    if(typeof record != "undefined" && record != null){
		    	record_data.setValue("userId",record.getValue("userId"));
		    	record_data.setValue("userName",record.getValue("userName"));
		    	record_data.setValue("orgId",record.getValue("orgId"));
		    	record_data.setValue("orgName",record.getValue("orgName"));
		    }
		}
	}
	
	//Text选择部门
	function LookupDropDown_Org_onSelect(dropdown,iframe,text){
		var dataset = $J(iframe.Dataset_Org);
		var node = $J(iframe.DataTree_Org).getCurrentNode();
	    var record = dataset.getCurrentRecord();
	    if(typeof record != "undefined" && record != null){
			$J("Text_orgId").setValue(record.getValue("orgId"),record.getValue("orgName"));
		}
	}	
</script>